/**
 * Project hdmap
 * @author shengjialiang
 * @version v1.0
 */


#include "map_dataset/IDataSet.h"
#include "map_dataset/Property.h"
#include "map_dataset/IFeature.h"

/**
 * IDataSet implementation
 */


namespace DataManager
{
    IDataSet::IDataSet()
    {
		mTransformation = osg::Matrix::identity();
		this->mpProperty = new CProperty();
    }

    IDataSet::~IDataSet()
    {
		if (this->mpProperty)
		{
			delete this->mpProperty;
			this->mpProperty = NULL;
		}
    }

	Common::CObjectVector* IDataSet::getFeaturesByOwnerID(const std::string& in_ownerID)
	{
		Common::CObjectVector* pFeatures = NULL;
		if (in_ownerID != "")
		{
			for (int i = 0; i < this->size(); ++i)
			{
				IFeature* pFeature =
					dynamic_cast<IFeature*>(this->get(i));
				if (pFeature && pFeature->getOwnerID() == in_ownerID)
				{
					if (NULL == pFeatures)
					{
						pFeatures = new Common::CObjectVector();
					}
					pFeatures->add(pFeature);
				}
			}
		}
		return pFeatures;
	}
}